package com.lavender.extention._failure_analyzer;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class TestCommandLineRunner implements CommandLineRunner {

    @Value("${name}")
    private String name;

    @Override
    public void run(String... args) throws Exception {
        /**
         * 1：未自定义FailureAnalyzer时，报错如下：
         * org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testCommandLineRunner':
         * Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException:
         * Could not resolve placeholder 'name' in value "${name}"
         *
         * Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'name' in value "${name}"
         *
         * 2：未自定义FailureAnalyzer时，报错如下：
         * ***************************
         * APPLICATION FAILED TO START
         * ***************************
         *
         * Description:
         *
         * Could not resolve placeholder 'name' in value "${name}"
         *
         * Action:
         *
         * Please check startup argument!
         */
        System.out.println(name);
    }
}
